package com.nidu.demo.config.convertor;

import com.nidu.demo.base.BaseConvertor;
import com.nidu.demo.config.dto.ConfigCO;
import com.nidu.demo.config.mapper.dataobject.ConfigDO;
import com.nidu.demo.config.model.Config;
import com.nidu.demo.convertor.MapStructConfig;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(config = MapStructConfig.class)
public interface ConfigConvertor extends BaseConvertor<ConfigDO, Config, ConfigCO> {
    
    @Override
    @Mapping(target = "createTime", ignore = true)
    @Mapping(target = "updateTime", ignore = true)
    @Mapping(target = "createBy", ignore = true)
    @Mapping(target = "updateBy", ignore = true)
    @Mapping(source = "configName", target = "name")
    @Mapping(source = "configKey", target = "key")
    @Mapping(source = "configValue", target = "value")
    ConfigDO toDataObject(Config config);

    @Override
    @Mapping(source = "name", target = "configName")
    @Mapping(source = "key", target = "configKey")
    @Mapping(source = "value", target = "configValue")
    Config toDomainObject(ConfigDO dataObject);
} 